import { httpClient } from '@/api'
import { Response, SystemLoginForm } from '@/types'

/**
 * 登录
 * @param form 表单
 */
const login = async (form: SystemLoginForm) => {
  const res = await httpClient.post<Response<string>>('/system/login', form)
  return res.data
}

/**
 * 确认登录状态
 */
const alreadyLogin = async () => {
  const res = await httpClient.get<boolean>('/system/login/status')
  return res.data
}

/**
 * 系统登录后端接口
 */
export const systemLoginApi = {
  login,
  alreadyLogin,
}
